/**
 * 
 */
package com.demo2do.fms.entity.business.shipment;

import java.math.BigDecimal;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;

/**
 * 调度指令订单 （目前用于生成派车单）
 * 
 * @author Ysy
 *
 */
@Entity
//@Table(name = "VW_SHIPMENT_ORDER")
@Table(name = "VW_SHIPMENT_ORDER_NO_FINANCE")
public class ShipmentOrder {

    @Id
    @GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "assigned")
    @Column(name = "order_id")
    private Long id;
    
    /** 订单号 */
    private String code;
    
    /** 客户  */
    private String client;
    
    /** 单价 */
    private BigDecimal contractRate;
    
    /** 调度指令号 */
    private String shipmentNumber;
    
    /** 派车单ID */
    private Long dispatchOrderId;
    
    /** 订单起始地 */
    private String startFacility;
    
    /** 订单目的地 */
    private String endFacility;
    
    /** 结算公里数 */
    private Long kilometer;
    
    /** 商品车列表 */
    @Transient
    private List<ShipmentOrderItem> shipmentOrderItems;
    
    /**
     * the default constructor
     */
    public ShipmentOrder() {
    }
    
    /**
     * @param id
     * @param shipmentNumber
     * @param dispatchOrderId
     */
    public ShipmentOrder(Long id, String shipmentNumber, Long dispatchOrderId) {
        this.id = id;
        this.shipmentNumber = shipmentNumber;
        this.dispatchOrderId = dispatchOrderId;
    }

    /**
     * 
     * @param shipmentOrderItems
     * @return
     */
    public ShipmentOrder initShipmentOrderItems(List<ShipmentOrderItem> shipmentOrderItems){
        this.shipmentOrderItems = shipmentOrderItems;
        return this;
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @return the code
     */
    public String getCode() {
        return code;
    }

    /**
     * @return the client
     */
    public String getClient() {
        return client;
    }

    /**
     * @return the contractRate
     */
    public BigDecimal getContractRate() {
        return contractRate;
    }

    /**
     * @return the shipmentNumber
     */
    public String getShipmentNumber() {
        return shipmentNumber;
    }

    /**
     * @return the dispatchOrderId
     */
    public Long getDispatchOrderId() {
        return dispatchOrderId;
    }

    /**
     * @return the startFacility
     */
    public String getStartFacility() {
        return startFacility;
    }

    /**
     * @return the endFacility
     */
    public String getEndFacility() {
        return endFacility;
    }

    /**
     * @return the kilometer
     */
    public Long getKilometer() {
        return kilometer;
    }

    /**
     * @return the shipmentOrderItems
     */
    public List<ShipmentOrderItem> getShipmentOrderItems() {
        return shipmentOrderItems;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param code the code to set
     */
    public void setCode(String code) {
        this.code = code;
    }

    /**
     * @param client the client to set
     */
    public void setClient(String client) {
        this.client = client;
    }

    /**
     * @param contractRate the contractRate to set
     */
    public void setContractRate(BigDecimal contractRate) {
        this.contractRate = contractRate;
    }

    /**
     * @param shipmentNumber the shipmentNumber to set
     */
    public void setShipmentNumber(String shipmentNumber) {
        this.shipmentNumber = shipmentNumber;
    }

    /**
     * @param dispatchOrderId the dispatchOrderId to set
     */
    public void setDispatchOrderId(Long dispatchOrderId) {
        this.dispatchOrderId = dispatchOrderId;
    }

    /**
     * @param startFacility the startFacility to set
     */
    public void setStartFacility(String startFacility) {
        this.startFacility = startFacility;
    }

    /**
     * @param endFacility the endFacility to set
     */
    public void setEndFacility(String endFacility) {
        this.endFacility = endFacility;
    }

    /**
     * @param kilometer the kilometer to set
     */
    public void setKilometer(Long kilometer) {
        this.kilometer = kilometer;
    }

    /**
     * @param shipmentOrderItems the shipmentOrderItems to set
     */
    public void setShipmentOrderItems(List<ShipmentOrderItem> shipmentOrderItems) {
        this.shipmentOrderItems = shipmentOrderItems;
    }
}
